package com.itheima.reggie.service.impl;

import com.itheima.reggie.entity.DishFlavor;
import com.itheima.reggie.mapper.DishFlavorMapper;
import com.itheima.reggie.service.DishFlavorService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class DishFlavorServiceImpl implements DishFlavorService {
    @Autowired(required = false)
    private DishFlavorMapper dishFlavorMapper;
    @Override
    public List<DishFlavor> findFlavorsByDishID(Long dishId) {
        List<DishFlavor> dishFlavors = dishFlavorMapper.findFlavorsByDishID(dishId);
        return dishFlavors;
    }

    @Override
    public DishFlavor findById(Integer id) {
        DishFlavor dishFlavor = dishFlavorMapper.findById(id);
        return dishFlavor;
    }

    @Override
    public Boolean addFlavor(DishFlavor dishFlavor) {
        Integer integer = dishFlavorMapper.addFlavor(dishFlavor);
        return integer>0;
    }

    @Override
    public Boolean delete(Long id) {
        Integer delete = dishFlavorMapper.delete(id);
        return delete>0;
    }

    @Override
    public Boolean addDishFlavor(List<DishFlavor> dishFlavors) {
        Integer integer = dishFlavorMapper.addDishFlavor(dishFlavors);
        return integer>0;
    }
}
